export function getAlarmRulesParams(params, form) {
  if (form.ruleType !== "analyseAlert") {
    params.remark = form.remark; //备注
  }

  if (form.ruleType === "singleAlert") {
    params.ruleDetails = {
      ruleType: form.ruleType,
      dataSourceId: form.ruleDetails.dataSourceId, // 索引类型
      mergeField: form.ruleDetails.mergeField, //告警合并字段
      condition: form.ruleDetails.condition, //过滤规则
      frequency: 1,
      frequencyType: 'min',
      timesInterval: 1,
      intervalType: 'min',
      threshold: 1.0,
    };
  } else if (form.ruleType === "countAlert") {
    //事件
    params.ruleDetails = {
      ruleType: form.ruleType,
      dataSourceId: form.ruleDetails.dataSourceId, // 索引类型
      mergeField: form.ruleDetails.mergeField, //告警合并字段
      condition: form.ruleDetails.condition, //过滤规则

      frequency: form.ruleDetails.frequency, //监控频率
      frequencyType: form.ruleDetails.frequencyType,
      timesInterval: form.ruleDetails.timesInterval, //统计时间范围
      intervalType: form.ruleDetails.intervalType,
      statsType: form.ruleDetails.statsType, // 统计方式
      aggField: form.ruleDetails.aggField, //统计字段（统计方式是值统计，不显示）
      threshold: form.ruleDetails.threshold, // 阈值
    };
  } else if (form.ruleType === "multiAlert") {
    //多维度
    params.ruleDetails = {
      ruleType: form.ruleType,
      dataSourceId: form.ruleDetails.dataSourceId, // 索引类型
      mergeField: form.ruleDetails.mergeField, //告警合并字段
      condition: form.ruleDetails.condition, //过滤规则

      frequency: form.ruleDetails.frequency, //监控频率
      frequencyType: form.ruleDetails.frequencyType,
      timesInterval: form.ruleDetails.timesInterval, //统计时间范围
      intervalType: form.ruleDetails.intervalType,
      logNum: form.ruleDetails.logNum, //日志条数
      dimensionDiff: form.ruleDetails.dimensionDiff, //不同维度
    };
  } else if (form.ruleType === "limitAlert") {
    //基线
    params.ruleDetails = {
      ruleType: form.ruleType,
      dataSourceId: form.ruleDetails.dataSourceId, // 索引类型
      mergeField: form.ruleDetails.mergeField, //告警合并字段
      condition: form.ruleDetails.condition, //过滤规则

      frequency: form.ruleDetails.frequency, //监控频率
      frequencyType: form.ruleDetails.frequencyType,
      timesInterval: form.ruleDetails.timesInterval, //统计时间范围
      intervalType: form.ruleDetails.intervalType,

      limitInterval: form.ruleDetails.limitInterval, //对比时间范围
      statsType: form.ruleDetails.statsType, // 统计方式
      limitField: form.ruleDetails.limitField, //对比字段
      rule1Type: form.ruleDetails.rule1Type, //条件1
      rule1Value: form.ruleDetails.rule1Value,
      rule2Type: form.ruleDetails.rule2Type, //条件2
      rule2Value: form.ruleDetails.rule2Value,
    };
  } else if (form.ruleType === "singleSequenceAlert") {
    //单数据源
    params.ruleDetails = {
      ruleType: form.ruleType,
      dataSourceId: form.ruleDetails.dataSourceId, // 索引类型
      mergeField: form.ruleDetails.mergeField, //告警合并字段
      condition: form.ruleDetails.condition, //过滤规则

      frequency: form.ruleDetails.frequency, //监控频率
      frequencyType: form.ruleDetails.frequencyType,
      timesInterval: form.ruleDetails.timesInterval, //统计时间范围
      intervalType: form.ruleDetails.intervalType,
      referenceFields: form.ruleDetails.referenceFields, //时序字段值
    };
  } else if (form.ruleType === "multiSequenceAlert") {
    //多数据源
    params.ruleDetails = {
      ruleType: form.ruleType,

      frequency: form.ruleDetails.frequency, //监控频率
      frequencyType: form.ruleDetails.frequencyType,
      timesInterval: form.ruleDetails.timesInterval, //统计时间范围
      intervalType: form.ruleDetails.intervalType,

      alertConditions: form.ruleDetails.alertConditions,
    };
  }
  return params;
}